<template>
	<view>
		<block v-if="list && list.length > 0">
		<view class="record-item" v-for="item in list">
		    <view class="record-infor">
		        <view class="record-title">{{ item.label }}</view>
		        <view class="record-time">{{ item.createtime }}</view>
		    </view>
		    <view class="record-money">
		        {{ item.price }}
		        <text>元</text>
		    </view>
		</view>
		</block>
		<uv-empty style="margin-top: 200rpx;" v-else-if="list && list.length == 0"></uv-empty>
		<view class='backbtn' @click="onBack">返回</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:1,
				loading:false,
				type:0,
			}
		},
		onLoad(option) {
			if(option.type) this.type = option.type;
			this.getList()
		},
		onReachBottom() {
			if(this.loading) return;
			this.getList()
		},
		methods: {
			onBack(){
				uni.navigateBack()
			},
			getList(){
				var t = this;
				var url = 'log';
				if(this.type == 'with') url = "with/log";
				this.util.post('agent/'+url,{page:this.page},(r)=>{
					if(t.page == 1) t.list = r.list;
					else t.list = t.list.concat(r.list);
					t.loading = r.list.length == 0;
					t.page++;
				})
			}
		}
	}
</script>

<style>
page {
    background: #f7f7f7;
}

.record-list {
    width: 100%;
}

.record-item {
    height: 130rpx;
    border-bottom: 1rpx solid #eeeeee;
    display: flex;
    align-items: center;
    padding: 0 30rpx;
    background: white;
}

.record-list .record-item:last-child {
    border: none;
}

.record-title {
    font-size: 30rpx;
    color: #333333;
    line-height: 42rpx;
}

.record-time {
    font-size: 24rpx;
    color: #999999;
    line-height: 34rpx;
}

.record-money {
    margin-left: auto;
    font-size: 34rpx;
    color: #333333;
}

.record-money text {
    font-size: 24rpx;
    color: #151515;
}
</style>
